package demo;

import java.awt.*;
import java.awt.image.*;

/**
 * 汉字点阵
 *
 * @author sun.ye
 * @since 2020-07-16 15:51
 */
public class ChineseWordCode {
    public ChineseWordCode(){
        BufferedImage image = new BufferedImage(50, 150, BufferedImage.TYPE_INT_RGB);
        Graphics2D g = image.createGraphics();
        g.setFont(new Font("宋体", Font.PLAIN, 16));
        g.drawString("口", 2, 11);
        int [] p = image.getRGB(0, 0, image.getWidth(), image.getHeight(), new int[image.getWidth()*image.getHeight()], 0, image.getWidth());
//        for (int i = 0; i < p.length ; i++) {
//            System.out.println(p[i]);
//        }
        for (int h = 0; h < image.getHeight(); h++) {
            for (int w = 0; w < image.getWidth(); w++) {
                System.out.print(p[h*image.getWidth() + w] == -1 ? "回" : "口");
            }
            System.out.println();
        }
    }

    public static void main(String args[]) {
        new ChineseWordCode();
    }
}